<template>
  <div class="my-goods-item">
    <!-- 选择控件 -->
    <div class="left">
      <div class="custom-control custom-checkbox">
        <input type="checkbox" class="custom-control-input" :id="dataObj.id" v-model="dataObjClone.goods_state"
        />
        <label class="custom-control-label" :for="dataObj.id">
          <img :src="dataObj.goods_img" alt="" />
        </label>
      </div>
    </div>
    <!-- 商品详情 -->
    <div class="right">
      <div class="top">{{dataObj.goods_name}}</div>
      <div class="bottom">
        <span class="price">{{dataObj.goods_price}}</span>
        <span>
          <MyCount :dataObj="dataObj"></MyCount>
        </span>
      </div>
    </div>
  </div>
</template>

<script>
import MyCount from "./MyCount.vue";
export default {
  components: {
    MyCount,
  },
  props: {
    dataObj: {
      typeof: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      dataObjClone: this.dataObj,
    };
  },
};
</script>

<style lang="less" scoped>
.my-goods-item {
  display: flex;
  padding: 10px;
  border-bottom: 1px solid #ccc;
  background-image: url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fitem%2F201407%2F13%2F20140713115209_4ycMM.thumb.400_0.jpeg&refer=http%3A%2F%2Fb-ssl.duitang.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1663673153&t=327c5521b5b042c887fe7d150a900c70);
  .left {
    img {
      width: 120px;
      height: 120px;
      margin-right: 8px;
      border-radius: 10px;
    }
    .custom-control-label::before,
    .custom-control-label::after {
      top: 50px;
    }
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .top {
      font-size: 14px;
      font-weight: 700;
    }
    .bottom {
      display: flex;
      justify-content: space-between;
      padding: 5px 0;
      align-items: center;
      .price {
        color: red;
        font-weight: bold;
      }
    }
  }
}
</style>